package com.example.productservice.client;

import com.example.productservice.entity.PageVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.core.annotation.Order;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author lenovo
 * @Description
 * @Date2025/4/18 下午2:38
 *
 */

@FeignClient(value = "order-service")
public interface OrderServiceFeignClient {

    @RequestMapping("/order/{id}")
    ResponseEntity<Order> findOrderById(@PathVariable Integer id);

    @GetMapping("/orders")
    ResponseEntity<List<Order>> findAllOrders();


    @GetMapping("order-page")
    ResponseEntity<PageVO> findOrdersPage(@RequestParam(value = "current", required = false, defaultValue = "1") Integer current,
                                         @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pagesize);


    @PostMapping("/order")
    ResponseEntity<String> addOrder(@RequestBody Order order);

    @PutMapping("/order")
    ResponseEntity<String> updateOrder(@RequestBody Order order) ;

    @DeleteMapping("/order/{id}")
    ResponseEntity<String> deleteOrder(@PathVariable Integer id);
}
